home *** CD-ROM | disk | FTP | other *** search
- /*
- A menu prog, I am bored, so, why not put in *MY* bid to take
- the place of MM? Oooohhhh.... Let's see,
- We want lots of configurability. Igor! Bring the config files!
- */
-
- #include <stdio.h>
- #include <stdlib.h>
- #include "menu.h"
-
- main(int argc, char *argv[])
- {
- int i=1;
- /* Engage command-line parser! */
-
- if (argc == 1) {
- printf("\a\nUuuuhhhhh... Yer supposed to tell me the config file name.");
- exit(0);
- }
- /* Okey-dokey, got that down, let's plop up the for loop.*/
- while(0==0) /* Index=2(i.e. second param, first is: menu.exe) Up Mr. Index. */
- {
- /* printf("%s", argv[i]);*/
- /* Bug test... */
- /*i=i + 1;*/
- /* We only need the config file name, nothing else. */
- /* Remember, include config file var def in h file. */
- config=fopen(argv[i], "r" );
- if (config == NULL)
- {
- /* Uh-oh... *BIG* problem... */
- printf("\a\nError: Unable to open config file %s!", argv[i]);
- printf("\nRead docs for help.");
- exit(1);
- }
- /* Now, let us test the error. */
-
- i=loadcnf(config);
- exit(0); /* Exit prog...*/
-
- }
- /*Let's roast this sucker....*/
- }
-
- atexit()
- {
- fclose(config);
- return 0;
- }
-
- /* Config file data loader. */
-
- int loadcnf(FILE *in)
- {
- char indata[40];
- int tmp;
- /* Struct defed in menu.h... */
- fscanf(in,"%s", indata);
- if (indata=="ON")
- {
- tmp=1;
- }
- else
- {
- tmp=0;
- }
- /*Parms.Color = tmp;*/
- /*indata="";*/
- fscanf(in, "%s", indata);
- Parms.EntryOne = indata; /* The beginnings of a long and painful process...*/
- /*indata="";*/
- fscanf(in, "%s", indata);
- Parms.EntryOnePath = indata;
- fscanf(in, "%s", indata);
- Parms.EntryTwo = indata;
- fscanf(in, "%s", indata);
- Parms.EntryTwoPath = indata;
- fscanf(in, "%s", indata);
- Parms.EntryThree = indata;
- fscanf(in, "%s", indata);
- Parms.EntryThreePath = indata;
- fscanf(in, "%s", indata);
- Parms.EntryFour = indata;
- fscanf(in, "%s", indata);
- Parms.EntryFourPath = indata;
- fscanf(in, "%s", indata);
- Parms.EntryFive = indata;
- fscanf(in, "%s", indata);
- Parms.EntryFivePath = indata;
- fscanf(in, "%s", indata);
- Parms.EntrySix = indata;
- fscanf(in, "%s", indata);
- Parms.EntrySixPath = indata;
- /* YESSSSSSS!!!!! I am *DONE* setting up the config reader!!!*/
- return 0;
- }